#include <iostream>

using namespace std;


class A{
private:
	int m_value;
public:
	A(int value){
		m_value = value;
	}
	
	void Print1(){
		printf("hello world");
	}
	
	void Print2(){
		printf("%d", m_value);
	}
};

struct s  
{
	char t:4;
	char k:4;
	unsigned short i:8;
	unsigned long m;  
};
 

class AA  
{
public:  
  AA() { p=this; }
  ~AA() {
	  if(p!=NULL){
		  delete p;
		  p=NULL;
	  }
  }

  AA* p;  
};

class ClxBase
{
public:
    ClxBase() {};
    virtual ~ClxBase() {cout << "Base destructor" << endl;};

    virtual void DoSomething() { cout << "Do something in class ClxBase!" << endl; };
};

class ClxDerived : public ClxBase
{
public:
    ClxDerived() {};
    ~ClxDerived() { cout << "Output from the destructor of class ClxDerived!" << endl; }; 

    void DoSomething() { cout << "Do something in class ClxDerived!" << endl; };
};

struct Point3D
{
	int x;
	int y;
	int z;
};

void testA(int p){return;}
void testA(int &p){return;}

int m1main(int argc, char* argv[])
{
	 Point3D* pPoint = NULL;
	 int offset = (int)(&(pPoint)->z);
	 printf("%d", offset);


	ClxBase *pTest = new ClxDerived;
	pTest->DoSomething();
	delete pTest;


	AA *a = new AA();
	delete a;


	cout << sizeof(s) << endl;


    A* pA = NULL;
    pA->Print1();
    pA->Print2(); 

    return 0;

}
